<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.util.*,java.io.*,java.sql.*,java.text.*, dbAccess.*"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content
-Type" content="text/html; charset=ISO-8859-1" />
<title>Doctor Create/Update Process</title>
<link rel="stylesheet" type="text/css" href="css_files/style.css" />
</head>
<body>
 <%
 
 	//create new doctor
 	Doctor newDoc = new Doctor(session.getAttribute("Name").toString());
 
 	String action = request.getParameter("action");
 	if (action.equals("update"))
 	{
 		newDoc.setDocId(Integer.parseInt(session.getAttribute("DocId").toString()));
 	}
  
  //tbl_person
   //out.print(request.getParameter("docSIN"));
   newDoc.setSIN(Integer.parseInt(request.getParameter("docSIN")));
   newDoc.setFirstName(request.getParameter("fName"));
   newDoc.setLastName(request.getParameter("lName"));
   newDoc.setPhoneNum(request.getParameter("phoneNumber"));
   newDoc.setHomeAddress(request.getParameter("homeAddress"));
   newDoc.setDocEmailAddress(request.getParameter("emailAddress"));
   newDoc.setPassword(request.getParameter("password"));
   newDoc.setDocRoom(request.getParameter("docRoom"));
   newDoc.setDocBuilding(request.getParameter("docBuilding"));
   
   
   //tbl_patient
  newDoc.setDateOfBirth((java.sql.Date.valueOf(request.getParameter("dateOfBirth").toString())));
  if (request.getParameter("gender").equals("male"))
  {
  	newDoc.setGender("M");
  }
  else
  {
 	newDoc.setGender("F");
  }
  //String Gender = request.getParameter("frmGender");
  
  if (newDoc.registerDoc(action))
  {
 	 out.print(newDoc.getStatusMsg());
 	 newDoc.setStatusMsg("");
  }
  else
  {
  	out.print("Failed to create Doctor: " + newDoc.getStatusMsg());
  	newDoc.setStatusMsg("");
  }
  
  String backHome = request.getParameter("callerId").toString() + ".jsp";
 %>
 <form id="frmback" action=<%=backHome %>>
 <input type="submit"  name="cmdStaffHome" id="cmdStaffHome" value="Back Home"/>
 </form>

</body>
</html>